-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpOpenAPI-4.0: implement validation #29687
mpOpenAPI-4.0: implement validation #29687
Conversation
The following files contain a string indicating discriminating content:
|
080a2fd
to
d240017
Compare
So that they can be shared with MP OpenAPI 4.0 Also add a validation result matcher so we get better test failure messages.
Once the app has been deployed, we expect the messages to have been logged, so we don't need to wait for them. This has no effect if the test passes, but makes it run much more quickly if the expected messages are not emitted.
0b57e23
to
ae9f366
Compare
#libby |
#build |
Your personal pipeline request is at https://libh-proxy1.fyre.ibm.com/cognitive/pipelineAnalysis.html?uuid=15a75c78-d991-42a3-9ea1-23a141218539 Target locations of links might be accessible only to IBM employees. |
This should now be fixed. |
Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_erroUHdgEe-ZBdXWdK7Miw Target locations of links might be accessible only to IBM employees. |
ae9f366
to
db07f5b
Compare
The build Azquelt-29687-20240920-1602 For help analyzing your personal build, go to https://libh-proxy1.fyre.ibm.com/cognitive/buildAnalysis.html?uuid=_erroUHdgEe-ZBdXWdK7Miw |
db07f5b
to
59c2c01
Compare
Fixed OSGi services not present during unit testing. #build |
Your personal pipeline request is at https://libh-proxy1.fyre.ibm.com/cognitive/pipelineAnalysis.html?uuid=b76f7cb8-b4b8-4e5f-b414-607fa2d10600 Target locations of links might be accessible only to IBM employees. |
Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_KWRkwHkpEe-PXJdaQbhamQ Target locations of links might be accessible only to IBM employees. |
59c2c01
to
f796d67
Compare
Personal build looks good |
The build Azquelt-29687-20240922-1533 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested a minor change
schemaPropertyEmptyArray=The \"{0}\" property of the Schema Object is an empty array | ||
schemaPropertyNotUnique=The elements of the \"{0}\" property of the Schema Object are not unique | ||
schemaInvalidType=The \"type\" property of the Schema Object must only contain values which are one of (\"null\", \"boolean\", \"object\", \"array\", \"number\", \"integer\", \"string\") | ||
schemaCollectionElementWrongType=The \"{0}\" property of the Schema Object contains a value which is not of type \"{1}\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace "which" with "that" or add a comma before "which"
@@ -64,6 +64,8 @@ nullValueInMap=The map specifies an invalid value for the \"{0}\" key. A map sho | |||
|
|||
openAPIVersionInvalid=The OpenAPI Object must contain a valid OpenAPI specification version. The \"{0}\" value specified for the OpenAPI specification version is not valid | |||
openAPITagIsNotUnique=The OpenAPI Object must contain unique tag names. The \"{0}\" tag name is not unique | |||
#3.1 | |||
openAPIMissingRequiredFields=The OpenAPI Object must contain at least one of the \"paths\", \"components\" or \"webhooks\" properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenAPI Object must contain at least one of the "paths", "components", or "webhooks" properties
@@ -112,9 +115,21 @@ schemaMultipleOfNotGreaterThanZero=The Schema Object must have the \"multipleOf\ | |||
schemaPropertyLessThanZero=The \"{0}\" property of the Schema Object must be greater than or equal to zero | |||
schemaTypeDoesNotMatchProperty=The \"{0}\" property is not appropriate for the Schema Object of \"{1}\" type | |||
|
|||
#3.1 | |||
schemaPropertyWrongType=The \"{0}\" property of the Schema Object must be of type \"{1}\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "{0}" property of the Schema Object must be a "{1}" type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still ok if the {1}
variable starts with a vowel?
The values used for {1}
in the code at the moment are "string", "number", "integer", "array", "object", "boolean", and "schema"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided on The type of the "{0}" property of the Schema Object must be "{1}"
schemaPropertyWrongType=The \"{0}\" property of the Schema Object must be of type \"{1}\" | ||
schemaPropertyEmptyArray=The \"{0}\" property of the Schema Object is an empty array | ||
schemaPropertyNotUnique=The elements of the \"{0}\" property of the Schema Object are not unique | ||
schemaInvalidType=The \"type\" property of the Schema Object must only contain values which are one of (\"null\", \"boolean\", \"object\", \"array\", \"number\", \"integer\", \"string\") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "type" property of the Schema Object must contain values that are one of ("null", "boolean", "object", "array", "number", "integer", or "string")
schemaPropertyEmptyArray=The \"{0}\" property of the Schema Object is an empty array | ||
schemaPropertyNotUnique=The elements of the \"{0}\" property of the Schema Object are not unique | ||
schemaInvalidType=The \"type\" property of the Schema Object must only contain values which are one of (\"null\", \"boolean\", \"object\", \"array\", \"number\", \"integer\", \"string\") | ||
schemaCollectionElementWrongType=The \"{0}\" property of the Schema Object contains a value which is not of type \"{1}\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "{0}" property of the Schema Object contains a value that is not a "{1}" type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{1}
may start with a vowel here too (same question as the above comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided on The "{0}" property of the Schema Object contains a value whose type is not "{1}"
e648ac2
to
6c6f01a
Compare
Message review changes made. #libby |
Your personal pipeline request is at https://libh-proxy1.fyre.ibm.com/cognitive/pipelineAnalysis.html?uuid=9638a01a-167d-443e-8f36-da4b64a9f7e8 Target locations of links might be accessible only to IBM employees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Missed a message change so need to re-request the build #build |
Your personal pipeline request is at https://libh-proxy1.fyre.ibm.com/cognitive/pipelineAnalysis.html?uuid=04dbecd8-f26b-4e88-8a22-08b4df7be45e Target locations of links might be accessible only to IBM employees. |
Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_85VRoHqgEe-PXJdaQbhamQ Target locations of links might be accessible only to IBM employees. |
Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_4QaeYHqjEe-PXJdaQbhamQ Target locations of links might be accessible only to IBM employees. |
Personal build looks good |
The build Azquelt-29687-20240924-1921 |
...pi_fat/fat/src/com/ibm/ws/microprofile/openapi/validation/fat/OpenAPIValidationTestFive.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header date needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header date needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header date needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header date needs updating
...l_test/src/io/openliberty/microprofile/openapi20/test/utils/TestValidationContextHelper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header date needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header date needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header date needs updating
The build Azquelt-29687-20240924-1942 |
OpenAPI 3.1 is fairly similar to 3.0, so we re-use a lot of the same validation logic. As well as adding the new rules, we needed to: - refactor reference validation, as references need to be validated differently - Change how we select which validator to use so that its based on the OpenAPI version specified in the document rather than on which version of the feature is running (ensuring mpOpenAPI-4.0 can still validate OpenAPI v3.0 documents if the user has requested that) - Make the 3.0 Schema validation code work with the mpOpenAPI-4.0 data model which has breaking API changes. The 3.0 validation needs to work with all versions of the model.
We were testing for each of the problem messages we expect, but we weren't testing for the top message which says "The following errors were found:"
Copy the existing OpenAPI v3.0 validation FAT tests and adjust them for the new validation rules in v3.1 and run them against OpenAPI v3.1 documents.
26bdb85
to
912b38a
Compare
Squashed the message reviews and updated the copyright headers. #libby |
Your personal pipeline request is at https://libh-proxy1.fyre.ibm.com/cognitive/pipelineAnalysis.html?uuid=a8a6ff16-6dac-44fb-924f-db293b95e6b9 Target locations of links might be accessible only to IBM employees. |
Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_kjdLQHwGEe-PXJdaQbhamQ Target locations of links might be accessible only to IBM employees. |
Code analysis and actionsDO NOT DELETE THIS COMMENT.
|
The build Azquelt-29687-20240926-0704 For help analyzing your personal build, go to https://libh-proxy1.fyre.ibm.com/cognitive/buildAnalysis.html?uuid=_kjdLQHwGEe-PXJdaQbhamQ |
Errors in the build do not appear to related to this change. |
release bug
label if applicable: https://github.com/OpenLiberty/open-liberty/wiki/Open-Liberty-Conventions).Fixes #28860